<template>
  <el-dialog
    title="修改拱顶下沉数据"
    :visible.sync="dialogEditorVisible"
    width="40%"
    :before-close="handleClose">
  <el-form   :inline="true"  ref="form" class="demo-form-inline" :model="currentRow"  label-width="100px">
    <el-form-item label="测量值">
      <el-input v-model="currentRow.headerValue"></el-input>
  </el-form-item>
  <el-form-item label="当日下沉值">
      <el-input v-model="currentRow.headerTodaySink"></el-input>
  </el-form-item>
  <el-form-item label="累计下沉值">
      <el-input v-model="currentRow.headerNumSink"></el-input>
  </el-form-item>
</el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogEditorVisible = false">取 消</el-button>
      <el-button type="primary" @click="create">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>

import api from "../../../api";
import qs from "qs"

export default {
  data(){
    return {
      wId:'',
      dialogEditorVisible: false,
      currentRow: {}
    }
  },
   props: {
    flag: {
      type: Boolean,
      default: false,
      pageNo:1
    },
  },
  mounted() {
    this.$bus.$on("onShowMonitorInfoEditor", (row) => {
       this.dialogEditorVisible = true;
       this.currentRow = row.rowData
       this.wId = row.wId
       this.pageNo = row.pageNo
     })
  },
  methods: {
      handleClose(done) {
              this.$confirm('确认关闭？')
                .then(_ => {
                 
                  done();
                }).catch(_ => {});
      },
      create(){
        api.monitorMeasurementUpdate(qs.stringify(this.currentRow)).then(res=>{
          if (res.data.code == 2001){
                this.$message({
                  type: 'success',
                  message: '更新成功!'
                });
               this.dialogEditorVisible = false
               this.$bus.$emit("onRefreshmonitorMeasuremen", {
                pageNo: this.pageNo,
              wId: this.form.wId,
              sId: this.form.sId,
            });
          }

        }).catch(err=>{
        })
      },
      onSubmit() {
        console.log('submit!');
      }

  }

}
</script>

<style scoped>
  .avatar-uploader .el-upload {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px dashed #d9d9d9;
    border-radius: 6PX;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    width: 50PX !important;
    height: 50PX !important;
    font-size: 28PX;
    line-height: 50PX !important;
    color: #8c939d;
    text-align: center;
  }
  .avatar {
    display: block;
    width: 50PX !important;
    height: 50PX !important;
  }
  .imgbeforepad{
    padding-top: 0px !important;
  }
  .avatar-uploader .el-icon-plus{
    margin: 15PX !important;
  }

</style>